<template>
  <div class style="width: 1000px;">
      <ts-select
                :source="DEPT_ATTR"
                v-model="targetCategory"
                title="科室属性："
                @selected="setSelectName($event,'deptAttrName',true)"
                ref="deptAttrName"
              ></ts-select>
    <!-- <ts-multi-mdl
        :mulitValue="businessUtils"
        title="业务模块"
        width="100%"
        type="text"
    ></ts-multi-mdl>-->
    远程数据树形下拉框
    {{roleId}}
    <ts-date v-model="targetCategory" title="调度开始时间:" placeholder width="100%"></ts-date>
    <ts-button
      @click="click"
      v-preventReClick="5000"
      type="custom"
      status="warning"
      icon="iconfont icon-Group-33"
    >测试多次重复请求</ts-button>
    <tsTopBar @topBarOptClick="topBarOptClick">
      <div slot="before" class="preview">
        <ts-select
          title-width="60"
          placeholder="请选择指标归类"
          :source="ssoMethodss"
          v-model="targetCategory"
          title="指标归类"
          :emphasize="true"
          width="200px"
          :setFixedPulldown="true"
        ></ts-select>
      </div>
    </tsTopBar>
    <ts-select
      title-width="60"
      placeholder="请选择指标归类"
      :source="ssoMethodss"
      v-model="targetCategory"
      title="指标归类"
      :emphasize="true"
      readonly
    ></ts-select>
    <ts-button @click="changeRole('SYS_ROLE_SUPERVISE')" v-preventReClick>SYS_ROLE_SUPERVISE</ts-button>
    <ts-button @click="changeRole('')">空</ts-button>
    <ts-button @click="changeRole('TSHLHT,z4')">'TSHLHT,z4'</ts-button>1111
    <!-- <ts-select
      :source="orgCodeFn"
      v-model="orgId"
      title="localSearch"
      placeholder
      width="100%"
      @change="getValueChange"
      @selected="getValue2"
    ></ts-select>本地树形下拉框 -->
    <div @click="roleId='11'">sada</div>
    <tsIconFontSelect title="33" />
    <!-- <tsTargetSelect v-model="roleId" title="指标弹框选择" @change="refresh" :source="targetSelectSource"></tsTargetSelect> -->

    <!-- 
    <ts-select
      :source="ssoMethodss"
      v-model="localData2"
      title="localSearch"
      placeholder
      width="100%"
    ></ts-select>本地数据下拉选择框
    <ts-select
      :source="ssoMethodsss"
      v-model="localData2"
      title="localSearch"
      :key="22222"
      placeholder
      width="100%"
    ></ts-select>远程数据普通下拉选择框
    <ts-select
      :source="sourceData"
      v-model="selss2"
      title="localSearch"
      placeholder
      width="100%"
      key="sel22"
    ></ts-select>远程数据普通下来框
    <ts-select
      :source="sourceDatacheck"
      v-model="selss"
      title="localSearch"
      placeholder
      width="100%"
      key="sel12222"
    ></ts-select>远程数据gird布局多选下拉
    <ts-select
      :source="sourceData2"
      v-model="selss"
      title="localSearch"
      placeholder
      width="100%"
      key="sel2222"
    ></ts-select>-->
    <!-- <ts-select
      :source="ssoMethodss"
      v-model="selss"
      title="localSearch"
      placeholder
      width="100%"
      key="sel1"
    ></ts-select>
    <ts-select
      :source="ssoMethod"
      v-model="sel"
      title="local"
      placeholder
      width="100%"
      @selected="select"
      key="sel2"
      v-if="cutS == 2"
    ></ts-select>

    <ts-select
      :source="json"
      v-model="jsonsel"
      title="单选"
      placeholder
      width="100%"
      @change="selectJson"
    ></ts-select>
    <ts-select
      :source="json_s"
      v-model="jsonsel_s"
      title="单选req"
      placeholder
      width="100%"
      @selected="selectJson"
    ></ts-select>
    <ts-select
      :source="jsonm"
      v-model="jsonselm"
      title="多选"
      placeholder
      width="100%"
      @change="selectJsons"
    ></ts-select>
    -->
    <!-- <dddd
      :source="treejson"
      v-model="treejsonsel"
      title="树"
      placeholder
      width="100%"
      @change="select"
    ></dddd>-->
    <ts-date v-model="treejsonsel" type="range" width="300px"></ts-date>
    <ts-select
      :source="ssoMethodss"
      v-model="jsonselm"
      title="多选"
      placeholder
      width="100%"
      @selected="selectJsons"
    ></ts-select>
    <!-- <ts-textarea title="文本域" placeholder="请输入" width="100%"></ts-textarea> -->
    <!-- <ts-multi-mdl :mulitValue="multiArr" title="业务模块" width="100%" type="text" @change="multi"></ts-multi-mdl> -->
    <!-- <div style="width: 600px; height: 400px;"> -->
    <!-- <ts-g2-chart title="图表" :chartType="1" :data="chartData"></ts-g2-chart> -->
    <!-- </div> -->
  </div>
</template>

<script>
// import dddd from './dddd'
import tsTargetSelect from './tsTargetSelect'
// import tsG2Chart from '@/components/tsG2Chart.vue'
// import topBarItemJSON from './topBarItem.json'
export default {
  name: 'testform',
  components: { tsTargetSelect },
  data: function() {
    return {
      value2: {
        b: 1
      },
       DEPT_ATTR: this.$utils.getDictSource('DEPT_ATTR', true),
      targetCategory: 'jz,jj,yj,ss',
      treeData: '2,12',
      sourceData2: {
        dataType: 'json',
        url: '/ts-system/api/datasource/list',
        method: 'post',
        data: [],
        isReq: true,
        grid: true,
        gridLiWidth: '50%',
        choice: true,
        text: 'dsName',
        code: 'id',
        value: {
          name: '',
          code: ''
        }
      },
      businessUtils: '[ { "value": "1" } ]',
      sourceDatacheck: {
        dataType: 'json',
        url: '/ts-system/api/datasource/list',
        method: 'post',
        data: [],
        isReq: true,
        text: 'dsName',
        code: 'id',
        value: {
          name: '',
          code: ''
        }
      },
      sourceData: {
        dataType: 'json',
        url: '/ts-system/api/datasource/list',
        method: 'post',
        data: [],
        isReq: true,
        choice: true,
        text: 'dsName',
        code: 'id',
        value: {
          name: '',
          code: ''
        }
      },
      // roleId: 'TSHLHT,z3',
      // urlTreedata: {
      //   tree: true,
      //   isClose: true,
      //   noParent: true,
      //   dataType: 'json',
      //   url: '/ts-system/api/role/tree',
      //   method: 'get',
      //   data: [],
      //   children: 'children',
      //   isReq: true,
      //   code: 'code',
      //   text: 'name',
      //   // treeExpand: t,
      //   maxHeight: 500
      // },
      roleId: '11',
      targetSelectSource: {
        choice: true
      },

      orgTree:[
  {
    "id": "73e740a45e8a4bfa8640c58aa26f53cf",
    "name": "湖南省人民医院",
    "nickName": "湖南省人民医院",
    "code": "SYR",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": [
      {
        "id": "623d0fcb6a493b00508fbf52",
        "name": "马王堆院区",
        "nickName": "马王堆院区",
        "code": "MWD",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      },
      {
        "id": "623d0fcb6a493b00508fbf53",
        "name": "天心阁院区",
        "nickName": "天心阁院区",
        "code": "TXG",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      },
      {
        "id": "62466e23a31d82455b1e8221",
        "name": "岳麓山院区",
        "nickName": null,
        "code": "YLS",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      }
    ]
  },
  {
    "id": "be79c236107c4efab30ef286d0adce17",
    "name": "南华大学附属第一医院",
    "nickName": "南华附一",
    "code": "NHFY",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": [
      {
        "id": "0d50e39323d446c8918eb10401ba0837",
        "name": "南华附一本院",
        "nickName": "本院",
        "code": "NHFY01",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      },
      {
        "id": "308195558769405952",
        "name": "南华附一分院",
        "nickName": "分院",
        "code": "NHFY02",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      }
    ]
  },
  {
    "id": "6237e0e4a31d8225a9ba00a9",
    "name": "益阳医共体",
    "nickName": null,
    "code": "ceshiqq",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": null
  },
  {
    "id": "464707374202142720",
    "name": "湖南中医药大学附属第一医院",
    "nickName": "中医附一",
    "code": "ZYFY",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": [
      {
        "id": "464707374206337024",
        "name": "中医附一本院",
        "nickName": "本院",
        "code": "ZYFY01",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      }
    ]
  },
  {
    "id": "462165619549794304",
    "name": "湖南省妇幼保健院",
    "nickName": null,
    "code": "HNSFY",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": [
      {
        "id": "46327174434891016192",
        "name": "本院",
        "nickName": "省妇幼本院",
        "code": "HNSFY01",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      }
    ]
  },
  {
    "id": "47767513581266792320",
    "name": "北海妇幼保健院",
    "nickName": "北海妇幼保健院",
    "code": "BHFY",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": [
      {
        "id": "47767513581666986624",
        "name": "北海妇幼保健院本院",
        "nickName": "本院",
        "code": "BHFY01",
        "belongsOrgName": null,
        "belongsOrgId": null,
        "belongsOrgCode": null,
        "type": "1",
        "count": null,
        "children": null
      }
    ]
  },
  {
    "id": "73e740a45e8a4bfa8640c58aa26f53cd",
    "name": "湖南创星科技股份有限公司",
    "nickName": "湖南创星科技股份有限公司",
    "code": "TRASEN",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": null
  },
  {
    "id": "6237e110a31d8225a9ba00aa",
    "name": "益阳三",
    "nickName": null,
    "code": "测试QQ",
    "belongsOrgName": null,
    "belongsOrgId": null,
    "belongsOrgCode": null,
    "type": "1",
    "count": null,
    "children": null
  }
],
      urlTreedata: {
        dataType: 'json',
        url: '/ts-system/api/role/tree',
        method: 'get',
        data: [],
        code: 'code',
        text: 'name',
        children: 'children',
        tree: true,
        treeType: 'checkbox',
        isLoading: false,
        isClose: true,
        noParent: true
      },
      value: '北师大2',
      istrue: true,
      rangetime: '',
      checkboxVal: 'name1:1;name4:4',
      switchs: 1,
      multiArr: [{ value: '1' }, { value: '2' }],
      radioVal: 2,
      sysType: [
        { name: 'name1', value: 1, text: '启用' },
        { name: 'name2', value: 2, text: '禁用' },
        { name: 'name3', value: 3, text: '只读' },
        { name: 'name4', value: 4, text: '删除' }
      ],
      sel: '',
      ssoMethod: {
        dataType: 'local',
        data: [
          { value: 1, label: 'Ajax' },
          { value: 2, label: 'Web' }
        ],
        code: 'value',
        text: 'label',
        value: {
          code: 1,
          name: 'Ajax'
        }
      },
      sels: 'defaultSys',
      localTree: [
        {
          value: '1',
          label: 'Web1',
          children: [
            {
              value: '11',
              label: 'Web11'
            },
            { value: '12', label: 'Web12' }
          ]
        },
        {
          value: '2',
          label: 'Web2',
          children: [
            { value: '21', label: 'Web21' },
            { value: '12', label: 'Web22' }
          ]
        },
        { value: '3', label: 'Web3' }
      ],
      orgId:'623d0fcb6a493b00508fbf53',
           orgCodeFn:{
         url: '/ts-system/api/thps/org/treeList',
        method: 'get',
        code: 'id',
        text: 'name',
        tree:true,
        treeType:'normal',
        isReq: true
      },
      localTreedata: {
        treeType: 'normal',
        dataType: 'local',
        tree: true,
        data: this.localTree,
        children: 'children',
        isReq: true,
        code: 'id',
        text: 'name',
        maxHeight: 300
      },
      ssoMethods: {
        dataType: 'local',
        // choice:true,
        tree: true,
        data: this.localTree,
        children: 'children',
        isReq: true,
        code: 'value',
        text: 'label',
        maxHeight: 300
        // value: {
        //   code: 1,
        //   name: 'Ajax'
        // }
      },
      selss: '60c19953a31d821d57ecbeaa',
      selss2: '60c19953a31d821d57ecbeaa,5ee82429aaf5f042fbc23e90',
      localData2: 1,
      ssoMethodss: {
        dataType:'json',
        url: '/ts-system/api/role/tree',
        method: 'get',
      //   data: [],
      //   children: 'children',
      //   isReq: true,
        code: 'code',
        text: 'name',
        // isReq: true,
        choice: true,
        grid: true,
        value: {
          code: '',
          name: ''
        }
      },
      ssoMethodsss: {
        dataType: 'local',
        data: [
          { value: 1, label: 'Ajax2' },
          { value: 2, label: 'Web2' }
        ],
        code: 'value',
        text: 'label',
        choice: true,
        isReq: true,
        value: {
          code: '',
          name: ''
        }
      },
      // 下拉树
      treejsonsel: 'SYS_ROLE_SUPERVISE',
      treejson: {
        dataType: 'json',
        url: '/ts-system/api/role/tree',
        method: 'get',
        data: {},
        code: 'code',
        text: 'name',
        children: 'children',
        tree: true,
        isSingle: true
      },
      // 单选基础配置
      jsonsel: '',
      json: {
        dataType: 'json',
        url: '/ts-portal/api/portal/elment/getElementsByName',
        method: 'get',
        data: {
          sidx: 'create_date',
          sord: 'desc',
          // pageSize: 20,
          pageNo: 1
        },
        page: 'pageNo',
        code: 'elementid',
        text: 'elementname',
        value: {
          name: '',
          code: ''
        }
      },
      // 单选基础配置
      jsonsel_s: '5d6ce9d1d38e544e3cd46dec',
      json_s: {
        dataType: 'json',
        url: '/ts-portal/api/portal/elment/getElementsByName',
        method: 'get',
        data: {
          sidx: 'create_date',
          sord: 'desc',
          // pageSize: 20,
          pageNo: 1
        },
        page: 'pageNo',
        code: 'elementid',
        text: 'elementname',
        condition: 'condition',
        isReq: true,
        value: {
          name: '',
          code: ''
        }
      },
      // 多选基础配置
      jsonselm: '5fc0c79fa31d8246c62f1a48,5d6e0afcd38e54129d76514e',
      jsonm: {
        dataType: 'json',
        url: '/ts-portal/api/portal/elment/getElementsByName',
        method: 'get',
        // data: [
        //   { name: 'name1', value: 1, text: '启用' },
        //   { name: 'name2', value: 2, text: '禁用' },
        //   { name: 'name3', value: 3, text: '只读' },
        //   { name: 'name4', value: 4, text: '删除' }
        // ],
        page: 'pageNo',
        code: 'elementid',
        text: 'elementname',
        choice: true,
        isReq: true,
        value: {
          name: 'a,b',
          code: '1,2'
        }
      },
      timeVal: '2020-07-28 10:20:30',
      dateVal: '2020-07-28 ~ 2020-08-04',
      dateObj: {},
      ssodata: {},
      // 图表数据
      chartData: [
        { column: 'London', category: 'Jan.', value: 18.9 },
        { column: 'London', category: 'Feb.', value: 28.8 },
        { column: 'London', category: 'Mar.', value: 39.3 },
        { column: 'London', category: 'Apr.', value: 81.4 },
        { column: 'London', category: 'May', value: 47 },
        { column: 'London', category: 'Jun.', value: 20.3 },
        { column: 'London', category: 'Jul.', value: 24 },
        { column: 'London', category: 'Aug.', value: 35.6 },
        { column: 'Berlin', category: 'Jan.', value: 12.4 },
        { column: 'Berlin', category: 'Feb.', value: 23.2 },
        { column: 'Berlin', category: 'Mar.', value: 34.5 },
        { column: 'Berlin', category: 'Apr.', value: 99.7 },
        { column: 'Berlin', category: 'May', value: 52.6 },
        { column: 'Berlin', category: 'Jun.', value: 35.5 },
        { column: 'Berlin', category: 'Jul.', value: 37.4 },
        { column: 'Berlin', category: 'Aug.', value: 42.4 }
      ],
      cutS: 1
    }
  },
  created() {},
  mounted() {
    // this.getSource()
    setTimeout(() => {
      this.localTreedata.data = this.orgTree
      this.checkboxVal = 'name1:1;name4:4;name2:2'
    }, 3000)
    this.nameChangeEvent({
      column: 123
    })
    // new Promise(() => {
    //   console.log('33333')
    // })
  },
  methods: {
    setSelectName(){
    },
    topBarOptClick() {
      console.log('topBarOptClick')
    },
    click() {
      debugger
      console.log('%%%%%')
    },
    changeRole(value) {
      this.roleId = value
    },
    changeUrl() {
      this.sourceData.url =
        '/ts-system/api/dict/item/list/PLAT_USER_EDITOR_REPORT'
      this.sourceData.method = 'get'
    },
    getSource() {
      //获取业务库
      let _this = this
      this.$api({
        url: '/ts-system/api/datasource/list',
        method: 'post',
        data: { pageSize: 200 }
      })
        .then(response => {
          if (response && response.rows) {
            let data = response.rows
            if (data.length > 0) {
              data.forEach(element => {
                element.label = element.dsName
                element.value = element.id
              })
            }
          }
        })
        .catch(error => {})
    },
    refresh(val) {},
    changeValue() {
      // this.ssoMethods.data =
      // if(this.sels==1){
      // this.sels=2
      // }else{
      //   this.sels=""
      // }
      this.sels = '12'
      // console.log(this.sels)
    },
    getValue(val) {
      // console.log(this.value2, '-------' + this.value)
    },
    getValue2(val, data) {
      // console.log(val, data, '当前值____' + this.selss)
    },
    getValueChange(val, row) {
      // console.log(val,row)
    },
    onBtn() {
      this.$mModal.confirm('您确定退出登录吗？').then(type => {
        if (type === 'confirm') {
          console.log('33333')
        }
      })
    },
    radioselect(v, o) {},
    nameChangeEvent({ column, row }) {},
    selectSearch(o) {
      this.cutS = o.value
      this.ssoMethodss.value = {
        name: o.label,
        code: o.value
      }
    },
    select(o, _o) {
      this.json.value.name = o.label
      this.json.value.code = o.value
    },
    selectJson(o, r) {
      this.jsonm.data.elementid = o.code
    },
    selectJsons(o) {
      // this.jsonsel = ''
    },
    // 图片成功回调
    iconSuccess(o, src) {
      this.ssodata.file = o[0]
    },
    multi(o) {},
    checkedchange(o) {},
    // 日期
    dateBack(o) {},
    //
    switchfn(v) {}
  }
}
</script>
<style scoped>
</style>
